<!-- 引入模板 -->
@extends('admin/layout/index')

<!-- 主要内容 -->
@section('content')
<div class="mws-panel-inner-wrap">
	<div class="mws-panel-body no-padding">
		<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
		<form action="/admin/staff/index" method='post'>
			{{ csrf_field() }}
				<div id="DataTables_Table_0_length" class="dataTables_length">
				<label>每页显示
				<select size="1" name="page_info_num" aria-controls="DataTables_Table_0">
					<option value="10" @if( !empty($var['page_info_num']) && $var['page_info_num'] == 10) selected @endif>10</option>
					<option value="25" @if( !empty($var['page_info_num']) && $var['page_info_num'] == 25) selected @endif>25</option>
					<option value="50" @if( !empty($var['page_info_num']) && $var['page_info_num'] == 50) selected @endif>50</option>
					<option value="100" @if( !empty($var['page_info_num']) && $var['page_info_num'] == 100) selected @endif>100</option>
				</select>
				 数据</label>
			</div>
			<div class="dataTables_filter" id="DataTables_Table_0_filter">
				<label>关键词: <input type="text" name='search' value="{{ old('search') }}"></label>
				<label><input type="submit" value='提交' aria-controls="DataTables_Table_0"></label>
			</div>
		</form>
			<table class="mws-table mws-datatable dataTable text-center" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
			<thead>
			<tr role="row">
				<th>ID</th>
				<th>登录账号</th>
				<th>年龄</th>
				<th>性别</th>
				<th>邮箱</th>
				<th>电话</th>
				<th>状态</th>
				<th>创建时间</th>
				<th>等级</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody role="alert" aria-live="polite" aria-relevant="all" >
			
			<!-- 遍历用户数据 -->
			@foreach( $data as $k => $v)
			<tr role="row">
				<td>{{ $v['id'] }}</td>
				<td>{{ $v['username'] }}</td>
				<td>{{ $v['age'] }}</td>
				@if( $v['sex'] == 1 )
				<td>男</td>
				@else
				<td>女</td>
				@endif
				<td>{{ $v['email'] }}</td>
				<td>{{ $v['phone'] }}</td>
				@if( $v['status'] == 1 )
				<td>可用</td>
				@else
				<td>不可用</td>
				@endif
				<td>{{ date('Y-m-d H:i:s',$v['ctime']) }}</td>
				@if( $v['rank'] == 1 )
				<td>超级管理员</td>
				@else
				<td>普通管理员</td>
				@endif
				<td class=" ">
					<span class="btn-group">
					<a href="/admin/staff/edit/{{ $v['id'] }}" class="btn btn-small"><i class="icon-pencil"></i></a>
					<a href="/admin/staff/delete/{{ $v['id'] }}" class="btn btn-small"><i class="icon-trash"></i></a>
					</span>
				</td>
			</tr>
			@endforeach
			</tbody>
			</table>
			
			<!-- 显示分页 -->
			<div class="dataTables_paginate paging_full_numbers" id="DataTables_Table_1_paginate">
				{!! $data->appends($var)->render() !!}
			</div>
		</div>
	</div>
</div>
@endsection